package com.enjoyor.soa.traffic.core.efoms.mapper.impl;

import org.springframework.stereotype.Service;

import com.enjoyor.soa.traffic.core.efoms.constant.FileInfoSqlId;
import com.enjoyor.soa.traffic.core.efoms.domain.FileInfo;
import com.enjoyor.soa.traffic.core.efoms.mapper.IFileInfoMapper;
import com.enjoyor.soa.traffic.frame.support.mybatis.mapper.impl.BaseMapper;

import java.util.List;

/**
 * @ClassNameFileInfoMapper
 * @Description TODO
 * @Author ZSY
 * @Date 2019/1/8 14:52
 * @Version 1.0
 **/
@Service
public class FileInfoMapper extends BaseMapper<FileInfo> implements IFileInfoMapper {

	/**
	 * 根据关联ID删除附件列表
	 * @param releteId
	 */
	@Override
	public void deleteFileByReleteId(String releteId) {
		sqlSessionTemplate.delete(getSqlName(FileInfoSqlId.SQL_DETELE_BY_RELETEID), releteId);
	}

	/**
	 * 根据关联ID查询附件列表
	 *
	 * @param releteId
	 * @return
	 */
	@Override
	public List<FileInfo> getFileListByReleteId(String releteId) {
		return 	sqlSessionTemplate.selectList(getSqlName(FileInfoSqlId.SQL_GET_FILELIST_BY_RELETEID), releteId);
	}

	/**
	 * 批量新增
	 *
	 * @param fileInfoList
	 */
	@Override
	public void insertFileBatch(List<FileInfo> fileInfoList) {
		sqlSessionTemplate.insert(getSqlName(FileInfoSqlId.SQL_INSERT_FILE_BATCH), fileInfoList);
	}

}
